package com.mju.controller;

import com.mju.controller.common.BaseController;
import com.mju.controller.common.JsonResult;
import com.mju.pojo.District;
import com.mju.service.IDistrictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/districts")
@Api(tags = "地区信息")
public class DistrictController extends BaseController {
    @Autowired
    private IDistrictService districtService;

  @ApiOperation("获取省市区数据")
  @GetMapping
  public JsonResult<List<District>> getByParent(String parent) {
        List<District> data = districtService.getByParent(parent);
        return new JsonResult<>(OK, data);
    }

}
